package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.RoleDto;
import com.zzyl.entity.Role;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Set;

@Mapper
public interface RoleMapper {
    /**
     * 分页查询
     * @param roleDto
     * @return
     */
    Page<Role> selectPage(RoleDto roleDto);

    void insert(Role role);

    @Select("select distinct resource_no from sys_role_resource where role_id = #{roleId};")
    Set<String> findCheckedResources(Long roleId);

    @Select("select * from sys_role where id = #{id}")
    Role selectById(Long id);

    void updateRole(Role role);

    @Delete("delete from sys_role where id = #{roleId}")
    void deleteById(Long roleId);
}
